package com.wtpaint.design.creational.singleton;

/**
 * 静态内部类实现单例
 */
public class StaticInnerClassSingleton {

    private static class InnerClass {
        private static StaticInnerClassSingleton singleton = new StaticInnerClassSingleton();
    }

    public static StaticInnerClassSingleton getInstance() {
        return InnerClass.singleton;
    }

    private StaticInnerClassSingleton() {
        if (null != InnerClass.singleton) {
            throw new RuntimeException("singleton can not be invoke");
        }
    }
}
